package homework.day1;

import java.io.File;
import java.io.IOException;
import java.util.Scanner;

public class Test1 {
    public static void main(String[] args) throws IOException {

        Scanner input = new Scanner(System.in);

        System.out.println("请输入你要创建的文件名");

        while (true){
            String fileName = input.nextLine();
            File file = new File("./test/"+fileName);

            if (file.exists()){
                System.out.println("该文件名已存在，请重新输入文件名");
            }else {
                file.createNewFile();
                System.out.println("文件" + fileName + "已创建成功");
                break;
            }
        }

    }
}
